package com.example.order.feign.fallback;

import java.math.BigDecimal;

import com.example.order.feign.ProductFeignClient;
import com.example.product.bean.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;


@Component    // 放在容器中使fallback生效
public class ProductFeignClientFallback implements ProductFeignClient {

    @Override
    public Product getProductById(Long id) {
        System.out.println("兜底回调。。。。");
        Product product = new Product();
        product.setId(id);
        product.setPrice(new BigDecimal("0"));
        product.setProductName("未知商品openfeign");
        product.setNum(0);

        return product;
    }
}
